package com.taihe.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by zwt on 2018/7/23.
 * 这个异常已处理类 如果还有自定义异常的话
 * 需要判断一下 如果有自定义异常 先处理自定义异常
 */
@ControllerAdvice
public class GlobalExcetion {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public String Error(HttpServletRequest request,Exception e){
        e.printStackTrace();
        return e.getMessage();

    }
}
